package com.tourism.home.controller.user;

import com.tourism.home.entity.Result;
import com.tourism.home.service.CollectionService;
import com.tourism.home.service.CommentService;
import com.tourism.home.service.LikesService;
import com.tourism.home.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class MessageController {
    @Autowired
    LikesService likesService;

    @Autowired
    CommentService commentService;

    @Autowired
    CollectionService collectionService;

    //ok
    @GetMapping("/message/likes/{uid}")
    Result getMessageLikes(@PathVariable("uid") Integer uid){
        return ResultUtil.success(likesService.getMessageByUID(uid));
    }


    //ok
    @PutMapping("/message/likes/update/status/{id}")
    Result updateLikesStatus(@PathVariable("id") Integer id){
        return ResultUtil.success(likesService.updateLikesStatus(id));
    }

    //ok
    @GetMapping("/message/comment/{uid}")
    Result getMessageComment(@PathVariable("uid") Integer uid){
        return ResultUtil.success(commentService.getMessageByUID(uid));
    }

    //ok
    @PutMapping("/message/comment/update/status/{id}")
    Result updateCommentStatus(@PathVariable("id") Integer id){
        return ResultUtil.success(commentService.updateCommentStatus(id));
    }


    //ok
    @GetMapping("/message/collection/{uid}")
    Result getMessageCollection(@PathVariable("uid") Integer uid){
        return ResultUtil.success(collectionService.getMessageByUID(uid));
    }

    //ok
    @PutMapping("/message/collection/update/status/{id}")
    Result updateCollectionStatus(@PathVariable("id") Integer id){
        return ResultUtil.success(collectionService.updateCollectionStatus(id));
    }
}
